<?php

namespace App\Http\Controllers\user;

use App\Http\Controllers\Controller;
use App\Models\UserInfo;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    //
    public function index(){
        $username='user模块下Index控制器下index方法';
        return view('user.index.index',['username'=>$username]);
    }
    public function myTest()
    {
        $username = 'user模块下Index控制器下mytest()';
        return view('user.index.mytest', ['username' => $username]);
    }
    public function myPost(Request $request){
        $username=$request->input('username');
        $userinfo=new UserInfo();
        $userinfo->setUsername($username);
        $userinfo->setAge(1);
        $userinfo->setAddress("Shanghai");
        return  ['userinfo' => $userinfo];
    }
    public function myGet(Request $request){
        $username=$request->input('username');
        $userinfo=new UserInfo();
        $userinfo->setUsername($username);
        $userinfo->setAge(1);
        $userinfo->setAddress("Shanghai");
        return  ['userinfo' => $userinfo];
    }
}
